FollowUp: Disable GCedMemoryUsage if no concurrent GC MXBean#4107
Conversation
Signed-off-by: Lantao Jin <ltjin@amazon.com>
integ-test/src/test/java/org/opensearch/sql/ppl/ResourceMonitorIT.java
Outdated
Show resolved
Hide resolved
|
No need to backport to 2.19-dev. The fixing is included in #4105 |
| private void registerGCListener() { | ||
| boolean registered = false; | ||
| List<GarbageCollectorMXBean> gcBeans = ManagementFactory.getGarbageCollectorMXBeans(); | ||
| if (gcBeans.stream() |
There was a problem hiding this comment.
Did we get runtime exception on 2.19-dev branch? Which JDK version this feature depend on?
There was a problem hiding this comment.
Haven't backported to 2.19-dev. I am still working on backporting #4105. Then the JDK version < 20, there is no specific G1 Concurrent GC Monitoring registered, ref https://github.com/openjdk/jdk/blob/jdk-19-ga/src/hotspot/share/gc/g1/g1MonitoringSupport.cpp#L91. From JDK 20, G1 Concurrent GC was registered in Monitoring, ref https://github.com/openjdk/jdk/blob/jdk-20-ga/src/hotspot/share/gc/g1/g1MonitoringSupport.cpp#L93.
This PR is to verify if there a Concurrent MXBean registered in JDK before initialing a GCedMemoryUsage.
Signed-off-by: Lantao Jin <ltjin@amazon.com>
Description
#3983 enables
GCedMemoryUsagefor Calcite. But when the Java version is less than 21, there is noConcurrentMXBeanreturned fromManagementFactory.getGarbageCollectorMXBeans(). Fallback it toRuntimeMemoryUsage.Related Issues
Resolves #[Issue number to be closed when this PR is merged]
Check List
--signoffor-s.By submitting this pull request, I confirm that my contribution is made under the terms of the Apache 2.0 license.
For more information on following Developer Certificate of Origin and signing off your commits, please check here.